home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{C7212F93-30E8-11D2-B450-0020AFD69DE6}#1.0#0"; "SocketX.OCX"
- Begin VB.Form UDPPeerB
- Caption = "UDPPeerB"
- ClientHeight = 2640
- ClientLeft = 4740
- ClientTop = 2715
- ClientWidth = 4080
- KeyPreview = -1 'True
- LinkTopic = "UDPPeerB"
- LockControls = -1 'True
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 2640
- ScaleWidth = 4080
- Begin SocketXCtl.SocketXCtl SocketX
- Left = 3240
- Top = 1560
- _cx = 847
- _cy = 847
- AcceptTimeout = 0
- BlockingMode = -842150451
- Blocking = -1 'True
- BroadcastEnabled= -1 'True
- ConnectTimeout = 0
- EventMask = 63
- KeepAliveEnabled= 0 'False
- LibraryName = "WSOCK32.DLL"
- LingerEnabled = 0 'False
- LingerMode = 0
- LingerTime = 0
- LocalAddress = ""
- LocalPort = 0
- OutOfBandEnabled= 0 'False
- ReceiveBufferSize= 8192
- ReceiveTimeout = 0
- RemoteAddress = ""
- RemoteName = ""
- ReuseAddressEnabled= 0 'False
- RemotePort = 0
- RouteEnabled = -1 'True
- SendTimeout = 0
- SendBufferSize = 8192
- SocketType = 0
- TcpNoDelayEnabled= 0 'False
- End
- Begin VB.ListBox lstTranscript
- Height = 1230
- Left = 120
- TabIndex = 1
- TabStop = 0 'False
- Top = 360
- Width = 3855
- End
- Begin VB.TextBox txtSend
- Height = 285
- Left = 120
- TabIndex = 0
- Top = 2040
- Width = 3855
- End
- Begin VB.Label Label1
- Caption = "Transcript:"
- Height = 255
- Left = 120
- TabIndex = 3
- Top = 120
- Width = 735
- End
- Begin VB.Label Label2
- Caption = "Enter message here then press Enter:"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 1800
- Width = 2655
- End
- Attribute VB_Name = "UDPPeerB"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- ' The following variable is set during UDPPeerA's Form_Load event
- Public RemoteAddress As String
- Private Sub Form_KeyPress(KeyAscii As Integer)
- If (KeyAscii = 13) Then
- If (txtSend.Text <> "") Then
- lstTranscript.AddItem "send: " & txtSend.Text
- SocketX.SendTo RemoteAddress, 1, txtSend.Text
- txtSend.Text = ""
- End If
- KeyAscii = 0
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- End
- End Sub
- Private Sub Form_Load()
- '
- ' set socket type to datagram
- '
- SocketX.SocketType = soxDatagram
- SocketX.EventMask = -1
- SocketX.Blocking = False
- SocketX.LocalAddress = RemoteAddress
- SocketX.LocalPort = 2
- SocketX.Create
- SocketX.Bind
- End Sub
- Private Sub SocketX_Receive(ByVal ErrorCode As Integer)
- Dim s As String
- '
- ' Data received, add it to the transcript list
- ' Use ReceiveFrom so we can pick up the sender's address
- '
- s = SocketX.ReceiveFrom
- lstTranscript.AddItem SocketX.PeerAddress & ":" & SocketX.PeerPort & " sent: " & s
- End Sub
-